package com.aaa.system.controller;

import com.aaa.common.entity.User;
import com.aaa.system.service.UserService;
import com.aaa.common.vo.Result;
import com.aaa.system.vo.UserVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.checkerframework.common.reflection.qual.GetMethod;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @program: aaa-hospital-parent
 * @description:
 * @author: 闫克起
 * @create: 2024-05-20 17:22
 **/
@RestController
@RequestMapping("system/user")
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("/selectByName/{name}")
    public Result<User> selectByName(@PathVariable String name){
        return userService.getByName(name);
    }

    @PostMapping("/list/{current}/{pageSize}")
    public Result<Page<User>> list(@PathVariable Integer current, @PathVariable Integer pageSize,@RequestBody UserVo userVo){
        return userService.selectByCondition(current,pageSize,userVo);
    }
    @GetMapping("/listUser")
    public Result<List<User>> listUser(){
        return userService.selectAll();
    }

    @PostMapping("batchDelete")
    public Result<String> batchDelete(@RequestBody List<Integer> ids){
        return userService.batchDelete(ids);
    }
    @PostMapping("batchResetPwd")
    public Result<String> batchResetPwd(@RequestBody List<Integer> ids){
        return userService.batchResetPwd(ids);
    }

    @PostMapping("/getScheduling")
    public Result<List<User>> getScheduling(@RequestBody Map<String,Object> map){
        return userService.getScheduling(map);
    }
}
